home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / ISSUE05 / TIPTRIX / CONTROL.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-12-07  |  1.1 KB  |  45 lines

  1. const
  2.      MAX_TABLES = 4;                 {No. of Procos Tables}
  3.  
  4.      {Constants for the array of tables}
  5.      TABLE_BACKUP = 1;
  6.      TABLE_RECOVERY = 2;
  7.      TABLE_REUSE = 3;
  8.      TABLE_SUMMARY = 4;
  9.  
  10. type
  11.     {Types for handling tables without having controls on-screen}
  12.     TableData = Array[1..MAX_TABLES] of TTable;
  13.  
  14. var
  15.    Data : TableData;
  16.  
  17. procedure TfrmTables.InitialiseTables;
  18. var
  19.    ptr : Integer;
  20. begin
  21.      {Setup the Table Pointers ready for use}
  22.      for ptr := 1 to MAX_TABLES do begin
  23.          {Point to the component on the form}
  24.          case ptr of
  25.               TABLE_BACKUP : Data[ptr] := tblBACKUP;
  26.               TABLE_RECOVERY : Data[ptr] := tblRECOVERY;
  27.               TABLE_REUSE : Data[ptr] := tblREUSE;
  28.               TABLE_SUMMARY : Data[ptr] := tblSUMMARY;
  29.          end;
  30.      end;
  31. end;
  32.  
  33. { ... }
  34. { example: Scanning through a table }
  35.  
  36. begin
  37.   With Data[TABLE_BACKUP] do begin
  38.     First;
  39.     repeat
  40.       {Do something, assuming there is at least one record in the table}
  41.       Next;
  42.     until Data[TABLE_BACKUP].Eof;
  43.   end;
  44. end;
  45.